home *** CD-ROM | disk | FTP | other *** search
-
-
-
- aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss((((3333ddddmmmm)))) aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss((((3333ddddmmmm))))
-
-
-
- NNNNAAAAMMMMEEEE
- alSetParams - set the values of audio resource parameters
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>>
-
- iiiinnnntttt aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss((((iiiinnnntttt rrrreeeessssoooouuuurrrrcccceeee,,,, AAAALLLLppppvvvv ****ppppvvvvssss,,,, iiiinnnntttt nnnnppppvvvvssss))))
-
- PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
- _r_e_s_o_u_r_c_e
- expects the resource on which you wish to set parameter values.
-
- _p_v_s is an array of ALpv structures, each of which contains a single
- parameter and its desired value.
-
- _n_p_v_s is the number of ALpv items in the array.
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss sets the values for a list of parameters on a specific audio
- resource.
-
- Each parameter/value pair is represented by a single ALpv structure:
-
- typedef struct {
- int param; /* parameter */
- ALvalue value; /* value */
- short sizeIn; /* size in -- 1st dimension */
- short size2In; /* size out -- 2nd dimension */
- short sizeOut; /* size out */
- short size2Out; /* size out -- 2nd dimension */
- } ALpv;
-
-
- The application should set the _p_a_r_a_m field in each ALpv to indicate which
- parameter is of interest.
-
- For parameters taking scalar values, the application should fill in the
- appropriate field of the _v_a_l_u_e field. For 32-bit integer values, this is
- the integer field (value.i). For 64-bit integer or fixed-point values,
- this is the long long field (value.ll).
-
- For parameters requiring non-scalar values, the application must set the
- pointer field of _v_a_l_u_e (value.ptr) to point to the structure, and set
- _s_i_z_e_I_n to indicate the size of the structure, in elements.
-
- aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss will set the _s_i_z_e_O_u_t field of each ALpv to indicate how many
- elements of that value it accepted. For valid scalar parameters, this is
- always 1. For non-scalar parameters, it will set _s_i_z_e_O_u_t to be the
- number of elements accepted. For any parameter, it can also set _s_i_z_e_O_u_t
- to a negative value to indicate an error with that particular
- parameter/value pair. This can be AL_INVALID_PARAM, indicating that the
- given parameter was unrecognized by the given resource, or
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss((((3333ddddmmmm)))) aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss((((3333ddddmmmm))))
-
-
-
- AL_INVALID_VALUE, indicating that the parameter was recognized but that
- the value was unacceptable.
-
- See the aaaallllPPPPaaaarrrraaaammmmssss((((3333ddddmmmm)))) man page for more information on the semantics of
- particular parameters.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEE
- The following example takes the name of a device and a rate in Hz as a
- command-line argument, and sets the rate on that device. Note that the
- device can be an input or output device (however, on a digital input
- device, the rate will be ignored, since such devices get their sample
- rate externally).
-
- #include <audio.h>
- #include <math.h> /* for atof */
-
- main(int argc, char **argv)
- {
- int rv;
- double rate;
- ALpv x[2];
-
- if (argc != 3) {
- printf("usage: %s <device> <rate>\n",argv[0]);
- exit(-1);
- }
-
- /*
- * Get an audio resource of a particular type (AL_DEVICE_TYPE)
- * from the name given on the command line.
- */
- rv = alGetResourceByName(AL_SYSTEM,argv[1],AL_DEVICE_TYPE);
- if (!rv) {
- printf("invalid device\n");
- exit(-1);
- }
-
- rate = atof(argv[2]);
-
- /*
- * Attempt to set a crystal-based 48000 Hz sample-rate on the
- * given device.
- */
- x[0].param = AL_MASTER_CLOCK;
- x[0].value.i = AL_CRYSTAL_MCLK_TYPE;
- x[1].param = AL_RATE;
- x[1].value.ll = alDoubleToFixed(rate);
- if (alSetParams(rv,x, 2)<0) {
- printf("setparams failed: %s\n",alGetErrorString(oserror()));
- }
- if (x[1].sizeOut < 0) {
- printf("rate was invalid\n");
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss((((3333ddddmmmm)))) aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss((((3333ddddmmmm))))
-
-
-
- }
- }
-
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- aaaallllSSSSeeeettttPPPPaaaarrrraaaammmmssss returns the number of recognized parameters in the given PV
- list. It can also return a negative value, and set an error code, to
- indicate errors with the entire _a_l_S_e_t_P_a_r_a_m_s call. In this case, the error
- code retrieved by oooosssseeeerrrrrrrroooorrrr((((3333CCCC)))) will be one of:
-
- AAAALLLL____BBBBAAAADDDD____PPPPVVVVBBBBUUUUFFFFFFFFEEEERRRR
- _p_v_s is invalid.
-
- AAAALLLL____BBBBAAAADDDD____BBBBUUUUFFFFFFFFEEEERRRRLLLLEEEENNNNGGGGTTTTHHHH
- _n_p_v_s is patently wrong (e.g. negative).
-
- AAAALLLL____BBBBAAAADDDD____DDDDEEEEVVVVIIIICCCCEEEE____AAAACCCCCCCCEEEESSSSSSSS
- The audio system is inaccessible, either because it is not installed
- on the system, or because it is incorrectly configured.
-
- AAAALLLL____BBBBAAAADDDD____RRRREEEESSSSOOOOUUUURRRRCCCCEEEE
- The given resource _r_e_s_o_u_r_c_e does not exist.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- alParams(3dm), alGetParams(3dm), alGetParamInfo(3dm), oserror(3C)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-